﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QuanLyGiaoVuDAL.DTO
{
    public class HocKyDTO
    {
        public System.Guid MaHocKy { get; set; }
        public int TenHocKy { get; set; }
        public System.Guid MaNamHoc { get; set; }
        public NamHocDTO NamHoc { set; get; }
        public String TenHocKyDayDu {
            get {
                try
                {
                    var ten = String.Format("Học kỳ {0} năm học {1} - {2}", TenHocKy, NamHoc.Nam1, NamHoc.Nam2);
                    return ten;
                }
                catch (Exception exception)
                {
                    return string.Empty;
                }
            }
        }

        public static bool operator <(HocKyDTO hk1, HocKyDTO hk2)
        {
            var nam11 = hk1.NamHoc.Nam1;
            var nam12 = hk2.NamHoc.Nam1;
            return  (!(nam11 > nam12 || (nam11 == nam12 && hk1.TenHocKy >= hk2.TenHocKy)));

        }

        public static bool operator >(HocKyDTO hk1, HocKyDTO hk2)
        {
            return (!(hk1 < hk2));
        }
    }
}
